package mechanism.exception;

import java.io.IOException;
//import java.io.*;

class MyDiv 
{
	int division(int a,int b)
	{
		return a/b;
	}
	
	int exec(int a,int b)
	{
		//throw new NullPointerException();
		return division(a,b);
	}
}

class Test4
{
	public static void main(String args[]) throws Exception
	{
		MyDiv myDiv=new MyDiv();
		try
		{
			//System.out.println(myDiv.exec(5,0));
			throw new IOException("only a ex"); //用语句抛出异常
			//System.out.println("try statement Done!");
			//return;
			
		}catch(ArithmeticException e)
		{
			//System.out.println(e.getMessage());
			//System.out.println(e/*.toString()*/);
			//e.printStackTrace();
			
			System.out.println("catch ArithmeticException !");
			
			//return;//返回语句将使得打不出main done!，但finally语句仍然可以运行
			//System.exit(-1);//用中止语句，finally语句不会运行
		}catch(IOException e)
		{
			System.out.println("catch IOE !");
		}
		finally
		{
			System.out.println("finally statement Done!");
		}
		
		System.out.println("main done!");
	}
}
